# -*- coding: utf-8 -*-
from openerp import tools
from openerp.osv import fields,osv

class sale_report(osv.osv):
	_name = "sale.report"
	_description = "Sales Orders Statistics"
	_auto = False
	_rec_name = 'date'
	
	_columns = {
		'date': fields.datetime(u'订单日期', readonly=True),
		'date_confirm': fields.date(u'确认日期', readonly=True),
        'product_id': fields.many2one('product.product', u'产品', readonly=True),
        'product_uom': fields.many2one('product.uom', u'计量单位', readonly=True),
        'product_uom_qty': fields.float('# of Qty', readonly=True),
		'partner_id':fields.many2one('res.partner',u'客户',readonly=True),
		'company_id':fields.many2one('res.company',u'公司',readonly=True),
		'user_id':fields.many2one('res.users',u'销售人员',readonly=True),
		'price_total':fields.float(u'总价',readonly=True),
		'delay':fields.float(u'延迟',digits=(16,2),readonly=True),
		'categ_id': fields.many2one('product.category',u'产品分类', readonly=True),
        'nbr': fields.integer('# of Lines', readonly=True),  # TDE FIXME master: rename into nbr_lines
		'state':fields.selection([
			('draft',u'报价单'),
            ('waiting_date', 'Waiting Schedule'),
            ('manual', 'Manual In Progress'),
            ('progress', 'In Progress'),
            ('invoice_except', 'Invoice Exception'),
            ('done', 'Done'),
            ('cancel', 'Cancelled')
			],u'订单状态',readonly=True),
			'pricelist_id': fields.many2one('product.pricelist', u'价格表', readonly=True),
            'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
            'section_id': fields.many2one('crm.case.section', u'销售团队')
		}
	_order = 'date desc'